
<script type="text/html" data-template-name="timeswitch">
    <div class="form-row">
        <label for="node-input-starttime"><i class="fa fa-clock-o"></i> Time&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;On</label>
        <select id="node-input-starttime" style="width:24% !important">
            <option value=  "0">00:00</option>
            <option value= "15">00:15</option>
            <option value= "30">00:30</option>
            <option value= "45">00:45</option>
            <option value= "60">01:00</option>
            <option value= "75">01:15</option>
            <option value= "90">01:30</option>
            <option value="105">01:45</option>
            <option value="120">02:00</option>
            <option value="135">02:15</option>
            <option value="150">02:30</option>
            <option value="165">02:45</option>
            <option value="180">03:00</option>
            <option value="195">03:15</option>
            <option value="210">03:30</option>
            <option value="225">03:45</option>
            <option value="240">04:00</option>
            <option value="255">04:15</option>
            <option value="270">04:30</option>
            <option value="285">04:45</option>
            <option value="300">05:00</option>
            <option value="315">05:15</option>
            <option value="330">05:30</option>
            <option value="345">05:45</option>
            <option value="360">06:00</option>
            <option value="375">06:15</option>
            <option value="390">06:30</option>
            <option value="405">06:45</option>
            <option value="420">07:00</option>
            <option value="435">07:15</option>
            <option value="450">07:30</option>
            <option value="465">07:45</option>
            <option value="480">08:00</option>
            <option value="495">08:15</option>
            <option value="510">08:30</option>
            <option value="525">08:45</option>
            <option value="540">09:00</option>
            <option value="555">09:15</option>
            <option value="570">09:30</option>
            <option value="585">09:45</option>
            <option value="600">10:00</option>
            <option value="615">10:15</option>
            <option value="630">10:30</option>
            <option value="645">10:45</option>
            <option value="660">11:00</option>
            <option value="675">11:15</option>
            <option value="690">11:30</option>
            <option value="705">11:45</option>
            <option value="720">12:00</option>
            <option value="735">12:15</option>
            <option value="750">12:30</option>
            <option value="765">12:45</option>
            <option value="780">13:00</option>
            <option value="795">13:15</option>
            <option value="810">13:30</option>
            <option value="825">13:45</option>
            <option value="840">14:00</option>
            <option value="855">14:15</option>
            <option value="870">14:30</option>
            <option value="885">14:45</option>
            <option value="900">15:00</option>
            <option value="915">15:15</option>
            <option value="930">15:30</option>
            <option value="945">15:45</option>
            <option value="960">16:00</option>
            <option value="975">16:15</option>
            <option value="990">16:30</option>
            <option value="1005">16:45</option>
            <option value="1020">17:00</option>
            <option value="1035">17:15</option>
            <option value="1050">17:30</option>
            <option value="1065">17:45</option>
            <option value="1080">18:00</option>
            <option value="1095">18:15</option>
            <option value="1110">18:30</option>
            <option value="1125">18:45</option>
            <option value="1140">19:00</option>
            <option value="1155">19:15</option>
            <option value="1170">19:30</option>
            <option value="1185">19:45</option>
            <option value="1200">20:00</option>
            <option value="1215">20:15</option>
            <option value="1230">20:30</option>
            <option value="1245">20:45</option>
            <option value="1260">21:00</option>
            <option value="1275">21:15</option>
            <option value="1290">21:30</option>
            <option value="1305">21:45</option>
            <option value="1320">22:00</option>
            <option value="1335">22:15</option>
            <option value="1350">22:30</option>
            <option value="1365">22:45</option>
            <option value="1380">23:00</option>
            <option value="1395">23:15</option>
            <option value="1410">23:30</option>
            <option value="1425">23:45</option>
            <option value="5000">Sunrise</option>
            <option value="6000">Sunset</option>
        </select>
        <div style="display:inline-block; width:12%; text-align:right;">Off</div>
        <select id="node-input-endtime" style="width:24% !important">
            <option value=  "0">00:00</option>
            <option value= "15">00:15</option>
            <option value= "30">00:30</option>
            <option value= "45">00:45</option>
            <option value= "60">01:00</option>
            <option value= "75">01:15</option>
            <option value= "90">01:30</option>
            <option value="105">01:45</option>
            <option value="120">02:00</option>
            <option value="135">02:15</option>
            <option value="150">02:30</option>
            <option value="165">02:45</option>
            <option value="180">03:00</option>
            <option value="195">03:15</option>
            <option value="210">03:30</option>
            <option value="225">03:45</option>
            <option value="240">04:00</option>
            <option value="255">04:15</option>
            <option value="270">04:30</option>
            <option value="285">04:45</option>
            <option value="300">05:00</option>
            <option value="315">05:15</option>
            <option value="330">05:30</option>
            <option value="345">05:45</option>
            <option value="360">06:00</option>
            <option value="375">06:15</option>
            <option value="390">06:30</option>
            <option value="405">06:45</option>
            <option value="420">07:00</option>
            <option value="435">07:15</option>
            <option value="450">07:30</option>
            <option value="465">07:45</option>
            <option value="480">08:00</option>
            <option value="495">08:15</option>
            <option value="510">08:30</option>
            <option value="525">08:45</option>
            <option value="540">09:00</option>
            <option value="555">09:15</option>
            <option value="570">09:30</option>
            <option value="585">09:45</option>
            <option value="600">10:00</option>
            <option value="615">10:15</option>
            <option value="630">10:30</option>
            <option value="645">10:45</option>
            <option value="660">11:00</option>
            <option value="675">11:15</option>
            <option value="690">11:30</option>
            <option value="705">11:45</option>
            <option value="720">12:00</option>
            <option value="735">12:15</option>
            <option value="750">12:30</option>
            <option value="765">12:45</option>
            <option value="780">13:00</option>
            <option value="795">13:15</option>
            <option value="810">13:30</option>
            <option value="825">13:45</option>
            <option value="840">14:00</option>
            <option value="855">14:15</option>
            <option value="870">14:30</option>
            <option value="885">14:45</option>
            <option value="900">15:00</option>
            <option value="915">15:15</option>
            <option value="930">15:30</option>
            <option value="945">15:45</option>
            <option value="960">16:00</option>
            <option value="975">16:15</option>
            <option value="990">16:30</option>
            <option value="1005">16:45</option>
            <option value="1020">17:00</option>
            <option value="1035">17:15</option>
            <option value="1050">17:30</option>
            <option value="1065">17:45</option>
            <option value="1080">18:00</option>
            <option value="1095">18:15</option>
            <option value="1110">18:30</option>
            <option value="1125">18:45</option>
            <option value="1140">19:00</option>
            <option value="1155">19:15</option>
            <option value="1170">19:30</option>
            <option value="1185">19:45</option>
            <option value="1200">20:00</option>
            <option value="1215">20:15</option>
            <option value="1230">20:30</option>
            <option value="1245">20:45</option>
            <option value="1260">21:00</option>
            <option value="1275">21:15</option>
            <option value="1290">21:30</option>
            <option value="1305">21:45</option>
            <option value="1320">22:00</option>
            <option value="1335">22:15</option>
            <option value="1350">22:30</option>
            <option value="1365">22:45</option>
            <option value="1380">23:00</option>
            <option value="1395">23:15</option>
            <option value="1410">23:30</option>
            <option value="1425">23:45</option>
            <option value="5000">Sunrise</option>
            <option value="6000">Sunset</option>
            <option value="10001">Start + 1 min</option>
            <option value="10002">Start + 2 mins</option>
            <option value="10005">Start + 5 mins</option>
            <option value="10010">Start + 10 mins</option>
            <option value="10015">Start + 15 mins</option>
            <option value="10030">Start + 30 mins</option>
            <option value="10060">Start + 60 mins</option>
            <option value="10090">Start + 90 mins</option>
            <option value="10120">Start + 120 mins</option>
        </select>
    </div>

  <div class="form-row" id="node-timeswitch-timezone-row">
    <label for="node-input-timezone">Timezone</label>
    <select id="node-input-timezone">
        <option>Africa/Abidjan</option>
        <option>Africa/Accra</option>
        <option>Africa/Addis_Ababa</option>
        <option>Africa/Algiers</option>
        <option>Africa/Asmara</option>
        <option>Africa/Asmera</option>
        <option>Africa/Bamako</option>
        <option>Africa/Bangui</option>
        <option>Africa/Banjul</option>
        <option>Africa/Bissau</option>
        <option>Africa/Blantyre</option>
        <option>Africa/Brazzaville</option>
        <option>Africa/Bujumbura</option>
        <option>Africa/Cairo</option>
        <option>Africa/Casablanca</option>
        <option>Africa/Ceuta</option>
        <option>Africa/Conakry</option>
        <option>Africa/Dakar</option>
        <option>Africa/Dar_Es_Salaam</option>
        <option>Africa/Djibouti</option>
        <option>Africa/Douala</option>
        <option>Africa/El_Aaiun</option>
        <option>Africa/Freetown</option>
        <option>Africa/Gaborone</option>
        <option>Africa/Harare</option>
        <option>Africa/Johannesburg</option>
        <option>Africa/Juba</option>
        <option>Africa/Kampala</option>
        <option>Africa/Khartoum</option>
        <option>Africa/Kigali</option>
        <option>Africa/Kinshasa</option>
        <option>Africa/Lagos</option>
        <option>Africa/Libreville</option>
        <option>Africa/Lome</option>
        <option>Africa/Luanda</option>
        <option>Africa/Lubumbashi</option>
        <option>Africa/Lusaka</option>
        <option>Africa/Malabo</option>
        <option>Africa/Maputo</option>
        <option>Africa/Maseru</option>
        <option>Africa/Mbabane</option>
        <option>Africa/Mogadishu</option>
        <option>Africa/Monrovia</option>
        <option>Africa/Nairobi</option>
        <option>Africa/Ndjamena</option>
        <option>Africa/Niamey</option>
        <option>Africa/Nouakchott</option>
        <option>Africa/Ouagadougou</option>
        <option>Africa/Porto-novo</option>
        <option>Africa/Sao_Tome</option>
        <option>Africa/Timbuktu</option>
        <option>Africa/Tripoli</option>
        <option>Africa/Tunis</option>
        <option>Africa/Windhoek</option>
        <option>America/Adak</option>
        <option>America/Anchorage</option>
        <option>America/Anguilla</option>
        <option>America/Antigua</option>
        <option>America/Araguaina</option>
        <option>America/Argentina</option>
        <option>America/Aruba</option>
        <option>America/Asuncion</option>
        <option>America/Atikokan</option>
        <option>America/Atka</option>
        <option>America/Bahia</option>
        <option>America/Bahia_Banderas</option>
        <option>America/Barbados</option>
        <option>America/Belem</option>
        <option>America/Belize</option>
        <option>America/Blanc-sablon</option>
        <option>America/Boa_Vista</option>
        <option>America/Bogota</option>
        <option>America/Boise</option>
        <option>America/Buenos_Aires</option>
        <option>America/Cambridge_Bay</option>
        <option>America/Campo_Grande</option>
        <option>America/Cancun</option>
        <option>America/Caracas</option>
        <option>America/Catamarca</option>
        <option>America/Cayenne</option>
        <option>America/Cayman</option>
        <option>America/Chicago</option>
        <option>America/Chihuahua</option>
        <option>America/Coral_Harbour</option>
        <option>America/Cordoba</option>
        <option>America/Costa_Rica</option>
        <option>America/Creston</option>
        <option>America/Cuiaba</option>
        <option>America/Curacao</option>
        <option>America/Danmarkshavn</option>
        <option>America/Dawson</option>
        <option>America/Dawson_Creek</option>
        <option>America/Denver</option>
        <option>America/Detroit</option>
        <option>America/Dominica</option>
        <option>America/Edmonton</option>
        <option>America/Eirunepe</option>
        <option>America/El_Salvador</option>
        <option>America/Ensenada</option>
        <option>America/Fort_Nelson</option>
        <option>America/Fort_Wayne</option>
        <option>America/Fortaleza</option>
        <option>America/Glace_Bay</option>
        <option>America/Godthab</option>
        <option>America/Goose_Bay</option>
        <option>America/Grand_Turk</option>
        <option>America/Grenada</option>
        <option>America/Guadeloupe</option>
        <option>America/Guatemala</option>
        <option>America/Guayaquil</option>
        <option>America/Guyana</option>
        <option>America/Halifax</option>
        <option>America/Havana</option>
        <option>America/Hermosillo</option>
        <option>America/Indiana</option>
        <option>America/Indianapolis</option>
        <option>America/Inuvik</option>
        <option>America/Iqaluit</option>
        <option>America/Jamaica</option>
        <option>America/Jujuy</option>
        <option>America/Juneau</option>
        <option>America/Kentucky</option>
        <option>America/Knox_In</option>
        <option>America/Kralendijk</option>
        <option>America/La_Paz</option>
        <option>America/Lima</option>
        <option>America/Los_Angeles</option>
        <option>America/Louisville</option>
        <option>America/Lower_Princes</option>
        <option>America/Maceio</option>
        <option>America/Managua</option>
        <option>America/Manaus</option>
        <option>America/Marigot</option>
        <option>America/Martinique</option>
        <option>America/Matamoros</option>
        <option>America/Mazatlan</option>
        <option>America/Mendoza</option>
        <option>America/Menominee</option>
        <option>America/Merida</option>
        <option>America/Metlakatla</option>
        <option>America/Mexico_City</option>
        <option>America/Miquelon</option>
        <option>America/Moncton</option>
        <option>America/Monterrey</option>
        <option>America/Montevideo</option>
        <option>America/Montreal</option>
        <option>America/Montserrat</option>
        <option>America/Nassau</option>
        <option>America/New_York</option>
        <option>America/Nipigon</option>
        <option>America/Nome</option>
        <option>America/Noronha</option>
        <option>America/North_Dakota</option>
        <option>America/Nuuk</option>
        <option>America/Ojinaga</option>
        <option>America/Panama</option>
        <option>America/Pangnirtung</option>
        <option>America/Paramaribo</option>
        <option>America/Phoenix</option>
        <option>America/Port-au-prince</option>
        <option>America/Port_Of_Spain</option>
        <option>America/Porto_Acre</option>
        <option>America/Porto_Velho</option>
        <option>America/Puerto_Rico</option>
        <option>America/Punta_Arenas</option>
        <option>America/Rainy_River</option>
        <option>America/Rankin_Inlet</option>
        <option>America/Recife</option>
        <option>America/Regina</option>
        <option>America/Resolute</option>
        <option>America/Rio_Branco</option>
        <option>America/Rosario</option>
        <option>America/Santa_Isabel</option>
        <option>America/Santarem</option>
        <option>America/Santiago</option>
        <option>America/Santo_Domingo</option>
        <option>America/Sao_Paulo</option>
        <option>America/Scoresbysund</option>
        <option>America/Shiprock</option>
        <option>America/Sitka</option>
        <option>America/St_Barthelemy</option>
        <option>America/St_Johns</option>
        <option>America/St_Kitts</option>
        <option>America/St_Lucia</option>
        <option>America/St_Thomas</option>
        <option>America/St_Vincent</option>
        <option>America/Swift_Current</option>
        <option>America/Tegucigalpa</option>
        <option>America/Thule</option>
        <option>America/Thunder_Bay</option>
        <option>America/Tijuana</option>
        <option>America/Toronto</option>
        <option>America/Tortola</option>
        <option>America/Vancouver</option>
        <option>America/Virgin</option>
        <option>America/Whitehorse</option>
        <option>America/Winnipeg</option>
        <option>America/Yakutat</option>
        <option>America/Yellowknife</option>
        <option>Antarctica/Casey</option>
        <option>Antarctica/Davis</option>
        <option>Antarctica/Dumontdurville</option>
        <option>Antarctica/Macquarie</option>
        <option>Antarctica/Mawson</option>
        <option>Antarctica/Mcmurdo</option>
        <option>Antarctica/Palmer</option>
        <option>Antarctica/Rothera</option>
        <option>Antarctica/South_Pole</option>
        <option>Antarctica/Syowa</option>
        <option>Antarctica/Troll</option>
        <option>Antarctica/Vostok</option>
        <option>Arctic/Longyearbyen</option>
        <option>Asia/Aden</option>
        <option>Asia/Almaty</option>
        <option>Asia/Amman</option>
        <option>Asia/Anadyr</option>
        <option>Asia/Aqtau</option>
        <option>Asia/Aqtobe</option>
        <option>Asia/Ashgabat</option>
        <option>Asia/Ashkhabad</option>
        <option>Asia/Atyrau</option>
        <option>Asia/Baghdad</option>
        <option>Asia/Bahrain</option>
        <option>Asia/Baku</option>
        <option>Asia/Bangkok</option>
        <option>Asia/Barnaul</option>
        <option>Asia/Beirut</option>
        <option>Asia/Bishkek</option>
        <option>Asia/Brunei</option>
        <option>Asia/Calcutta</option>
        <option>Asia/Chita</option>
        <option>Asia/Choibalsan</option>
        <option>Asia/Chongqing</option>
        <option>Asia/Chungking</option>
        <option>Asia/Colombo</option>
        <option>Asia/Dacca</option>
        <option>Asia/Damascus</option>
        <option>Asia/Dhaka</option>
        <option>Asia/Dili</option>
        <option>Asia/Dubai</option>
        <option>Asia/Dushanbe</option>
        <option>Asia/Famagusta</option>
        <option>Asia/Gaza</option>
        <option>Asia/Harbin</option>
        <option>Asia/Hebron</option>
        <option>Asia/Ho_Chi_Minh</option>
        <option>Asia/Hong_Kong</option>
        <option>Asia/Hovd</option>
        <option>Asia/Irkutsk</option>
        <option>Asia/Istanbul</option>
        <option>Asia/Jakarta</option>
        <option>Asia/Jayapura</option>
        <option>Asia/Jerusalem</option>
        <option>Asia/Kabul</option>
        <option>Asia/Kamchatka</option>
        <option>Asia/Karachi</option>
        <option>Asia/Kashgar</option>
        <option>Asia/Kathmandu</option>
        <option>Asia/Katmandu</option>
        <option>Asia/Khandyga</option>
        <option>Asia/Kolkata</option>
        <option>Asia/Krasnoyarsk</option>
        <option>Asia/Kuala_Lumpur</option>
        <option>Asia/Kuching</option>
        <option>Asia/Kuwait</option>
        <option>Asia/Macao</option>
        <option>Asia/Macau</option>
        <option>Asia/Magadan</option>
        <option>Asia/Makassar</option>
        <option>Asia/Manila</option>
        <option>Asia/Muscat</option>
        <option>Asia/Nicosia</option>
        <option>Asia/Novokuznetsk</option>
        <option>Asia/Novosibirsk</option>
        <option>Asia/Omsk</option>
        <option>Asia/Oral</option>
        <option>Asia/Phnom_Penh</option>
        <option>Asia/Pontianak</option>
        <option>Asia/Pyongyang</option>
        <option>Asia/Qatar</option>
        <option>Asia/Qostanay</option>
        <option>Asia/Qyzylorda</option>
        <option>Asia/Rangoon</option>
        <option>Asia/Riyadh</option>
        <option>Asia/Saigon</option>
        <option>Asia/Sakhalin</option>
        <option>Asia/Samarkand</option>
        <option>Asia/Seoul</option>
        <option>Asia/Shanghai</option>
        <option>Asia/Singapore</option>
        <option>Asia/Srednekolymsk</option>
        <option>Asia/Taipei</option>
        <option>Asia/Tashkent</option>
        <option>Asia/Tbilisi</option>
        <option>Asia/Tehran</option>
        <option>Asia/Tel_Aviv</option>
        <option>Asia/Thimbu</option>
        <option>Asia/Thimphu</option>
        <option>Asia/Tokyo</option>
        <option>Asia/Tomsk</option>
        <option>Asia/Ujung_Pandang</option>
        <option>Asia/Ulaanbaatar</option>
        <option>Asia/Ulan_Bator</option>
        <option>Asia/Urumqi</option>
        <option>Asia/Ust-nera</option>
        <option>Asia/Vientiane</option>
        <option>Asia/Vladivostok</option>
        <option>Asia/Volgograd</option>
        <option>Asia/Yakutsk</option>
        <option>Asia/Yangon</option>
        <option>Asia/Yekaterinburg</option>
        <option>Asia/Yerevan</option>
        <option>Atlantic/Azores</option>
        <option>Atlantic/Bermuda</option>
        <option>Atlantic/Canary</option>
        <option>Atlantic/Cape_Verde</option>
        <option>Atlantic/Faeroe</option>
        <option>Atlantic/Faroe</option>
        <option>Atlantic/Jan_Mayen</option>
        <option>Atlantic/Madeira</option>
        <option>Atlantic/Reykjavik</option>
        <option>Atlantic/South_Georgia</option>
        <option>Atlantic/St_Helena</option>
        <option>Atlantic/Stanley</option>
        <option>Australia/Act</option>
        <option>Australia/Adelaide</option>
        <option>Australia/Brisbane</option>
        <option>Australia/Broken_Hill</option>
        <option>Australia/Canberra</option>
        <option>Australia/Currie</option>
        <option>Australia/Darwin</option>
        <option>Australia/Eucla</option>
        <option>Australia/Hobart</option>
        <option>Australia/Lhi</option>
        <option>Australia/Lindeman</option>
        <option>Australia/Lord_Howe</option>
        <option>Australia/Melbourne</option>
        <option>Australia/North</option>
        <option>Australia/Nsw</option>
        <option>Australia/Perth</option>
        <option>Australia/Queensland</option>
        <option>Australia/South</option>
        <option>Australia/Sydney</option>
        <option>Australia/Tasmania</option>
        <option>Australia/Victoria</option>
        <option>Australia/West</option>
        <option>Australia/Yancowinna</option>
        <option>Brazil/Acre</option>
        <option>Brazil/Denoronha</option>
        <option>Brazil/East</option>
        <option>Brazil/West</option>
        <option>Canada/Atlantic</option>
        <option>Canada/Central</option>
        <option>Canada/East-saskatchewan</option>
        <option>Canada/Eastern</option>
        <option>Canada/Mountain</option>
        <option>Canada/Newfoundland</option>
        <option>Canada/Pacific</option>
        <option>Canada/Saskatchewan</option>
        <option>Canada/Yukon</option>
        <option>Chile/Continental</option>
        <option>Chile/Easterisland</option>
        <option>ETC/GMT+0.5</option>
        <option>ETC/GMT+0</option>
        <option>ETC/GMT+1.5</option>
        <option>ETC/GMT+10.5</option>
        <option>ETC/GMT+10</option>
        <option>ETC/GMT+11.5</option>
        <option>ETC/GMT+11</option>
        <option>ETC/GMT+12.5</option>
        <option>ETC/GMT+12</option>
        <option>ETC/GMT+13.5</option>
        <option>ETC/GMT+13</option>
        <option>ETC/GMT+14</option>
        <option>ETC/GMT+1</option>
        <option>ETC/GMT+2.5</option>
        <option>ETC/GMT+2</option>
        <option>ETC/GMT+3.5</option>
        <option>ETC/GMT+3</option>
        <option>ETC/GMT+4.5</option>
        <option>ETC/GMT+4</option>
        <option>ETC/GMT+5.5</option>
        <option>ETC/GMT+5</option>
        <option>ETC/GMT+6.5</option>
        <option>ETC/GMT+6</option>
        <option>ETC/GMT+7.5</option>
        <option>ETC/GMT+7</option>
        <option>ETC/GMT+8.5</option>
        <option>ETC/GMT+8</option>
        <option>ETC/GMT+9.5</option>
        <option>ETC/GMT+9</option>
        <option>ETC/GMT-0.5</option>
        <option>ETC/GMT-0</option>
        <option>ETC/GMT-1.5</option>
        <option>ETC/GMT-10.5</option>
        <option>ETC/GMT-10</option>
        <option>ETC/GMT-11.5</option>
        <option>ETC/GMT-11</option>
        <option>ETC/GMT-12.5</option>
        <option>ETC/GMT-12</option>
        <option>ETC/GMT-13.5</option>
        <option>ETC/GMT-13</option>
        <option>ETC/GMT-14</option>
        <option>ETC/GMT-1</option>
        <option>ETC/GMT-2.5</option>
        <option>ETC/GMT-2</option>
        <option>ETC/GMT-3.5</option>
        <option>ETC/GMT-3</option>
        <option>ETC/GMT-4.5</option>
        <option>ETC/GMT-4</option>
        <option>ETC/GMT-5.5</option>
        <option>ETC/GMT-5</option>
        <option>ETC/GMT-6.5</option>
        <option>ETC/GMT-6</option>
        <option>ETC/GMT-7.5</option>
        <option>ETC/GMT-7</option>
        <option>ETC/GMT-8.5</option>
        <option>ETC/GMT-8</option>
        <option>ETC/GMT-9.5</option>
        <option>ETC/GMT-9</option>
        <option>ETC/GMT0</option>
        <option>ETC/GMT</option>
        <option>ETC/Greenwich</option>
        <option>ETC/Universal</option>
        <option>ETC/Utc</option>
        <option>ETC/Zulu</option>
        <option>Europe/Amsterdam</option>
        <option>Europe/Andorra</option>
        <option>Europe/Astrakhan</option>
        <option>Europe/Athens</option>
        <option>Europe/Belfast</option>
        <option>Europe/Belgrade</option>
        <option>Europe/Berlin</option>
        <option>Europe/Bratislava</option>
        <option>Europe/Brussels</option>
        <option>Europe/Bucharest</option>
        <option>Europe/Budapest</option>
        <option>Europe/Busingen</option>
        <option>Europe/Chisinau</option>
        <option>Europe/Copenhagen</option>
        <option>Europe/Dublin</option>
        <option>Europe/Gibraltar</option>
        <option>Europe/Guernsey</option>
        <option>Europe/Helsinki</option>
        <option>Europe/Isle_Of_Man</option>
        <option>Europe/Istanbul</option>
        <option>Europe/Jersey</option>
        <option>Europe/Kaliningrad</option>
        <option>Europe/Kiev</option>
        <option>Europe/Kirov</option>
        <option>Europe/Lisbon</option>
        <option>Europe/Ljubljana</option>
        <option>Europe/London</option>
        <option>Europe/Luxembourg</option>
        <option>Europe/Madrid</option>
        <option>Europe/Malta</option>
        <option>Europe/Mariehamn</option>
        <option>Europe/Minsk</option>
        <option>Europe/Monaco</option>
        <option>Europe/Moscow</option>
        <option>Europe/Nicosia</option>
        <option>Europe/Oslo</option>
        <option>Europe/Paris</option>
        <option>Europe/Podgorica</option>
        <option>Europe/Prague</option>
        <option>Europe/Riga</option>
        <option>Europe/Rome</option>
        <option>Europe/Samara</option>
        <option>Europe/San_Marino</option>
        <option>Europe/Sarajevo</option>
        <option>Europe/Saratov</option>
        <option>Europe/Simferopol</option>
        <option>Europe/Skopje</option>
        <option>Europe/Sofia</option>
        <option>Europe/Stockholm</option>
        <option>Europe/Tallinn</option>
        <option>Europe/Tirane</option>
        <option>Europe/Tiraspol</option>
        <option>Europe/Ulyanovsk</option>
        <option>Europe/Uzhgorod</option>
        <option>Europe/Vaduz</option>
        <option>Europe/Vatican</option>
        <option>Europe/Vienna</option>
        <option>Europe/Vilnius</option>
        <option>Europe/Volgograd</option>
        <option>Europe/Warsaw</option>
        <option>Europe/Zagreb</option>
        <option>Europe/Zaporozhye</option>
        <option>Europe/Zurich</option>
        <option>Indian/Antananarivo</option>
        <option>Indian/Chagos</option>
        <option>Indian/Christmas</option>
        <option>Indian/Cocos</option>
        <option>Indian/Comoro</option>
        <option>Indian/Kerguelen</option>
        <option>Indian/Mahe</option>
        <option>Indian/Maldives</option>
        <option>Indian/Mauritius</option>
        <option>Indian/Mayotte</option>
        <option>Indian/Reunion</option>
        <option>Mexico/Bajanorte</option>
        <option>Mexico/Bajasur</option>
        <option>Mexico/General</option>
        <option>Pacific/Apia</option>
        <option>Pacific/Auckland</option>
        <option>Pacific/Bougainville</option>
        <option>Pacific/Chatham</option>
        <option>Pacific/Chuuk</option>
        <option>Pacific/Easter</option>
        <option>Pacific/Efate</option>
        <option>Pacific/Enderbury</option>
        <option>Pacific/Fakaofo</option>
        <option>Pacific/Fiji</option>
        <option>Pacific/Funafuti</option>
        <option>Pacific/Galapagos</option>
        <option>Pacific/Gambier</option>
        <option>Pacific/Guadalcanal</option>
        <option>Pacific/Guam</option>
        <option>Pacific/Honolulu</option>
        <option>Pacific/Johnston</option>
        <option>Pacific/Kiritimati</option>
        <option>Pacific/Kosrae</option>
        <option>Pacific/Kwajalein</option>
        <option>Pacific/Majuro</option>
        <option>Pacific/Marquesas</option>
        <option>Pacific/Midway</option>
        <option>Pacific/Nauru</option>
        <option>Pacific/Niue</option>
        <option>Pacific/Norfolk</option>
        <option>Pacific/Noumea</option>
        <option>Pacific/Pago_Pago</option>
        <option>Pacific/Palau</option>
        <option>Pacific/Pitcairn</option>
        <option>Pacific/Pohnpei</option>
        <option>Pacific/Ponape</option>
        <option>Pacific/Port_Moresby</option>
        <option>Pacific/Rarotonga</option>
        <option>Pacific/Saipan</option>
        <option>Pacific/Samoa</option>
        <option>Pacific/Tahiti</option>
        <option>Pacific/Tarawa</option>
        <option>Pacific/Tongatapu</option>
        <option>Pacific/Truk</option>
        <option>Pacific/Wake</option>
        <option>Pacific/Wallis</option>
        <option>Pacific/Yap</option>
        <option>UTC/GMT+0.5</option>
        <option>UTC/GMT+1.5</option>
        <option>UTC/GMT+10.5</option>
        <option>UTC/GMT+10</option>
        <option>UTC/GMT+11.5</option>
        <option>UTC/GMT+11</option>
        <option>UTC/GMT+12.5</option>
        <option>UTC/GMT+12</option>
        <option>UTC/GMT+13.5</option>
        <option>UTC/GMT+13</option>
        <option>UTC/GMT+14</option>
        <option>UTC/GMT+1</option>
        <option>UTC/GMT+2.5</option>
        <option>UTC/GMT+2</option>
        <option>UTC/GMT+3.5</option>
        <option>UTC/GMT+3</option>
        <option>UTC/GMT+4.5</option>
        <option>UTC/GMT+4</option>
        <option>UTC/GMT+5.5</option>
        <option>UTC/GMT+5</option>
        <option>UTC/GMT+6.5</option>
        <option>UTC/GMT+6</option>
        <option>UTC/GMT+7.5</option>
        <option>UTC/GMT+7</option>
        <option>UTC/GMT+8.5</option>
        <option>UTC/GMT+8</option>
        <option>UTC/GMT+9.5</option>
        <option>UTC/GMT+9</option>
        <option>UTC/GMT-0.5</option>
        <option>UTC/GMT-1.5</option>
        <option>UTC/GMT-10.5</option>
        <option>UTC/GMT-10</option>
        <option>UTC/GMT-11.5</option>
        <option>UTC/GMT-11</option>
        <option>UTC/GMT-12.5</option>
        <option>UTC/GMT-12</option>
        <option>UTC/GMT-13.5</option>
        <option>UTC/GMT-13</option>
        <option>UTC/GMT-14</option>
        <option>UTC/GMT-1</option>
        <option>UTC/GMT-2.5</option>
        <option>UTC/GMT-2</option>
        <option>UTC/GMT-3.5</option>
        <option>UTC/GMT-3</option>
        <option>UTC/GMT-4.5</option>
        <option>UTC/GMT-4</option>
        <option>UTC/GMT-5.5</option>
        <option>UTC/GMT-5</option>
        <option>UTC/GMT-6.5</option>
        <option>UTC/GMT-6</option>
        <option>UTC/GMT-7.5</option>
        <option>UTC/GMT-7</option>
        <option>UTC/GMT-8.5</option>
        <option>UTC/GMT-8</option>
        <option>UTC/GMT-9.5</option>
        <option>UTC/GMT-9</option>
        <option>UTC/GMT0</option>
        <option>UTC</option>
    </select>
  </div>

  <div class="form-row" id="latlonrow">
    <label for="node-input-lat"><i class="fa fa-globe"></i> Place&nbsp;&nbsp;&nbsp;&nbsp;Lat</label>
    <input type="text" id="node-input-lat" placeholder="51.025" style="width:22%">
    <div style="display:inline-block; width:12%; text-align:right;">Lon</div>
    <input type="text" id="node-input-lon" placeholder="-1.4" style="width:22%">
  </div>

  <div class="form-row" id="offsetrow">
    <label for="node-input-dawnoff">Offset&nbsp;:&nbsp;Sunrise</label>
    <input type="text" id="node-input-dawnoff" placeholder="0" style="width:22%">
    <div style="display:inline-block; width:12%; text-align:right;">Sunset</div>
    <input type="text" id="node-input-duskoff" placeholder="0" style="width:22%">
  </div>

  <style>input[type=checkbox] { vertical-align:top; position:relative; bottom:1px; }</style>

  <div>
    <span style="width: 55px; float: left; margin-left: 5px;"><input type="checkbox" id="node-input-sun" placeholder="sun" > Sun </span>
    <span style="width: 55px; float: left; margin-left: 5px;"><input type="checkbox" id="node-input-mon" placeholder="mon" > Mon </span>
    <span style="width: 55px; float: left; margin-left: 5px;"><input type="checkbox" id="node-input-tue" placeholder="tue" > Tue </span>
    <span style="width: 55px; float: left; margin-left: 5px;"><input type="checkbox" id="node-input-wed" placeholder="wed" > Wed </span>
    <span style="width: 55px; float: left; margin-left: 5px;"><input type="checkbox" id="node-input-thu" placeholder="thu" > Thu </span>
    <span style="width: 55px; float: left; margin-left: 5px;"><input type="checkbox" id="node-input-fri" placeholder="fri" > Fri </span>
    <span style="width: 55px; float: left; margin-left: 5px;"><input type="checkbox" id="node-input-sat" placeholder="sat" > Sat </span>
  </div>
  <br/><br/>
  <div>
    <span style="width: 55px; float: left; margin-left: 5px;"><input type="checkbox" id="node-input-jan" placeholder="jan" > Jan </span>
    <span style="width: 55px; float: left; margin-left: 5px;"><input type="checkbox" id="node-input-feb" placeholder="feb" > Feb </span>
    <span style="width: 55px; float: left; margin-left: 5px;"><input type="checkbox" id="node-input-mar" placeholder="mar" > Mar </span>
    <span style="width: 55px; float: left; margin-left: 5px;"><input type="checkbox" id="node-input-apr" placeholder="apr" > Apr </span>
    <span style="width: 55px; float: left; margin-left: 5px;"><input type="checkbox" id="node-input-may" placeholder="may" > May </span>
    <span style="width: 55px; float: left; margin-left: 5px;"><input type="checkbox" id="node-input-jun" placeholder="jun" > Jun </span>
    <br/>
    <span style="width: 55px; float: left; margin-left: 5px;"><input type="checkbox" id="node-input-jul" placeholder="jul" > Jul </span>
    <span style="width: 55px; float: left; margin-left: 5px;"><input type="checkbox" id="node-input-aug" placeholder="aug" > Aug </span>
    <span style="width: 55px; float: left; margin-left: 5px;"><input type="checkbox" id="node-input-sep" placeholder="sep" > Sep </span>
    <span style="width: 55px; float: left; margin-left: 5px;"><input type="checkbox" id="node-input-oct" placeholder="oct" > Oct </span>
    <span style="width: 55px; float: left; margin-left: 5px;"><input type="checkbox" id="node-input-nov" placeholder="nov" > Nov </span>
    <span style="width: 55px; float: left; margin-left: 5px;"><input type="checkbox" id="node-input-dec" placeholder="dec" > Dec </span>
  </div>
  <br/><br/>
  <div class="form-row">
    <label for="node-input-mytopic"><i class="fa fa-tasks"></i> Topic </label>
    <input type="text" id="node-input-mytopic" placeholder="optional msg.topic">
  </div>
  <div class="form-row">
        <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
        <input type="text" id="node-input-name" placeholder="Name">
    </div>
</script>

<script type="text/javascript">

    function getSunriseSunsetUsage() {
        var startTime = parseInt($("#node-input-starttime").val());
        var endTime = parseInt($("#node-input-endtime").val());
        return {
            sunrise: !isNaN(startTime) && startTime >= 5000,
            sunset: !isNaN(endTime) && endTime >= 5000
        }
    }

    function updaterows() {
        if (($("#node-input-starttime").val() >= 5000 ) || ($("#node-input-endtime").val() == 5000 ) || ($("#node-input-endtime").val() == 6000 )) {
            $("#latlonrow").show();
            $("#offsetrow").show();
        } else {
            $("#latlonrow").hide();
            $("#offsetrow").hide();
        }
    }

    function updateTimezone() {
        var usage = getSunriseSunsetUsage();
        if (usage.sunrise && usage.sunset) {
            $("#node-timeswitch-timezone-row").hide();
        } else {
            $("#node-timeswitch-timezone-row").show();
        }
    }

    function validateLatLon (arg) {
        var usage = getSunriseSunsetUsage();
        if (!usage.sunrise && !usage.sunset) {
            return true;
        }
        return RED.validators.number()(arg);
    }

    RED.nodes.registerType('timeswitch',{
        category: 'time',
        color:"#6699ff",
        defaults: {
            name: {value:""},
            mytopic: {value:""},
            lat: {value:"", validate:validateLatLon},
            lon: {value:"", validate:validateLatLon},
            starttime: {value:"5000", required: true},
            endtime: {value:"780", required: true},
            timezone: {value:Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC"},
            duskoff: {value:"0", required: true},
            dawnoff: {value:"0", required: true},
            sun: {value:true},
            mon: {value:true},
            tue: {value:true},
            wed: {value:true},
            thu: {value:true},
            fri: {value:true},
            sat: {value:true},
            jan: {value:true},
            feb: {value:true},
            mar: {value:true},
            apr: {value:true},
            may: {value:true},
            jun: {value:true},
            jul: {value:true},
            aug: {value:true},
            sep: {value:true},
            oct: {value:true},
            nov: {value:true},
            dec: {value:true}
        },
        inputs:0,
        outputs:1,
        icon: "timer.png",
        label: function() {
            return this.name||"timeswitch";
        },
        labelStyle: function() {
            return this.name?"node_label_italic":"";
        },
        oneditprepare: function() {
            if (($("#node-input-lat").val() === "") && ($("#node-input-lon").val() === "")) {
                if ("geolocation" in navigator) {
                    navigator.geolocation.getCurrentPosition(function(position) {
                        $("#node-input-lat").val(Number(position.coords.latitude.toFixed(5)));
                        $("#node-input-lon").val(Number(position.coords.longitude.toFixed(5)));
                    });
                }
            }
            $("#node-input-starttime").change(function() {
                updaterows();
                updateTimezone();
            });
            $("#node-input-endtime").change(function() {
                updaterows();
                updateTimezone();
            });
            if (!$("#node-input-timezone").val()) {
                $("#node-input-timezone").val("UTC")
            }
        },
        button: {
            onclick: function() {
                $.ajax({
                    url: "timeswitch/"+this.id,
                    type:"POST",
                    success: function(resp) {
                        RED.notify("Successfully injected: ","success");
                    },
                    error: function(jqXHR,textStatus,errorThrown) {
                        if (jqXHR.status === 404) {
                            RED.notify("<strong>Error</strong>: timeswitch node not deployed","error");
                        } else if (jqXHR.status === 500) {
                            RED.notify("<strong>Error</strong>: timeswitch reset failed, see log for details.","error");
                        } else if (jqXHR.status === 0) {
                            RED.notify("<strong>Error</strong>: no response from server","error");
                        } else {
                            RED.notify("<strong>Error</strong>: unexpected error: ("+jqXHR.status+") "+textStatus,"error");
                        }
                    }
                });
            }
        }
    });
</script>
